<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
  <meta charset="utf-8">
  <title>异步请求</title>

  <link rel="stylesheet" href="libs/element-ui/index.css"/>
  <script src="libs/vue/vue.js"></script>
  <script src="libs/element-ui/index.js"></script>
  <script src="libs/axios/axios.min.js"></script>
  <script src="libs/clipboard/clipboard.js"></script>
</head>

<body>



<div id="app">

  <h3>想要请求的数据是:{{info}}</h3>
  <br/>
  <el-button @click="getInfo">发起请求</el-button>

</div>

<script>
  let app = new Vue({
    el: "#app",
    data: {
      info: ""
    },
    methods: {
      getInfo: function () {
        //Get方式
        let url = "${pageContext.request.contextPath}/get";
        console.log("[访问路径]:"+url);
        axios.get(url).then(resp=>{
          this.info = resp.data;
          alert("[成功]:"+this.info);
          console.log(this.info);
        }).catch(err=>{
          alert("[失败信息]:"+err.toString());
        });

      }
    }
  })
</script>

</body>
</html>
